package com.threegroup.android3grouppersonality.ui.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.threegroup.android3grouppersonality.R;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btn_registerOK;//注册
    private Button btn_registerCancel;//取消输入内容
    private EditText et_registerUserName;//注册的用户名
    private EditText et_registerUserPwd;//注册的密码
    private EditText et_registerUserPhone;//注册的手机号

    private Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        initView();
    }

    private void initView() {
        btn_registerOK=findViewById(R.id.btn_registerOK);
        btn_registerCancel=findViewById(R.id.btn_registerCancel);
        et_registerUserName=findViewById(R.id.et_registerUserName);
        et_registerUserPwd=findViewById(R.id.et_registerUserPwd);
        et_registerUserPhone=findViewById(R.id.et_registerUserPhone);

        btn_registerOK.setOnClickListener(this);
        btn_registerCancel.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_registerOK://成功→登录
                intent = new Intent(this, LoginActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_registerCancel:
                setNullText();
                break;
        }
    }

    private void setNullText() {//将输入的内容设置为""
        et_registerUserName.setText("");
        et_registerUserPwd.setText("");
        et_registerUserPhone.setText("");
    }
}
